import request from '@/utils/request'

// 登录
export const adminLogin = (data) => {
  return request({
    method: 'POST',
    url: '/admin/login',
    data
  })
}

// 获取学员列表
export const getStudentList = () => {
  return request({
    method: 'GET',
    url: '/student/list'
  })
}

// 删除指定学员
export const delStudent = id => {
  return request({
    method: 'DELETE',
    url: `/student/delete/${id}`
  })
}

// 获取指定学员详细信息
export const getStudentInfo = id => {
  return request({
    method: 'GET',
    url: `/student/detail/${id}`
  })
}

// 更新指定学员信息
export const changeStudentInfo = (id, data) => {
  return request({
    method: 'PUT',
    url: `/student/update/${id}`,
    data
  })
}

// 更新用户头像
export const changeUserPhoto = (username, data) => {
  return request({
    method: 'PATCH',
    url: `/admin/userPhoto/${username}`,
    data
  })
}

// 更新指定学员信息
export const addStudentList = data => {
  return request({
    method: 'POST',
    url: '/student/insert',
    data
  })
}
